# -*- coding: utf-8 -*-
# @Time : 2018/12/24 12:12
# @Author : Administrator
# @File : httptestV2.py
# @Project : python_demo
# @title : agileone新增公告
import unittest,http.client

from py41.http_test.read_data import Common


class AgileoneAdd():

    def __init__(self):
        self.con=http.client.HTTPConnection("localhost",8088)


    def test_login(self,username,password,savelogin,expect):

        self.con.request(method="POST",url="/agileone/index.php/common/login",
                         body="username="+username+"&password="+password+"&savelogin="+savelogin,
                         headers={"Content-Type": "application/x-www-form-urlencoded"})
        actual_login=self.con.getresponse().read().decode()
        # print(actual_login)
        # print(expect)
        if actual_login==expect:
            print("ok")
        else:
            print("ko")

    def test_add(self):
        pass





if __name__ == '__main__':
   AgileoneAdd().test_add()